home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / libsrc / c / dos / doslock.s < prev    next >
Encoding:
Text File  |  1994-01-09  |  1.4 KB  |  68 lines

  1. /* This is file DOSLOCK.S */
  2. /*
  3. ** Public domain, written by Pasi Eronen (pasi@forum.nullnet.fi).
  4. **
  5. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  6. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  7. */
  8.  
  9.         .text
  10.         .globl __dos_lock
  11.         .globl __dos_unlock
  12. __dos_lock:
  13.         /* int fd, long offset, long length */
  14.     pushl    %ebx
  15.     pushl    %esi
  16.     pushl    %edi
  17.  
  18.         movl    16(%esp),%ebx
  19.         movl    20(%esp),%ecx
  20.     shrl    $16,%ecx
  21.     movl    20(%esp),%edx
  22.         andl    $0xffff,%edx
  23.         movl    24(%esp),%esi
  24.         shrl    $16,%esi
  25.         movl    24(%esp),%edi
  26.         andl    $0xffff,%edi
  27.  
  28.         movw    $0x5c00,%ax
  29.     int    $0x21
  30.     popl    %edi
  31.     popl    %esi
  32.     popl    %ebx
  33.  
  34.         jb      error_found
  35.         mov     $0,%eax
  36. error_found:
  37.         andl    $0xffff,%eax
  38.         ret
  39.  
  40. __dos_unlock:
  41.         /* int fd, long offset, long length */
  42.         pushl   %ebx
  43.     pushl    %esi
  44.     pushl    %edi
  45.  
  46.         movl    16(%esp),%ebx
  47.         movl    20(%esp),%ecx
  48.     shrl    $16,%ecx
  49.     movl    20(%esp),%edx
  50.         andl    $0xffff,%edx
  51.         movl    24(%esp),%esi
  52.         shrl    $16,%esi
  53.         movl    24(%esp),%edi
  54.         andl    $0xffff,%edi
  55.  
  56.         movw    $0x5c01,%ax
  57.     int    $0x21
  58.     popl    %edi
  59.     popl    %esi
  60.     popl    %ebx
  61.  
  62.         jb      error_found2
  63.         mov     $0,%eax
  64. error_found2:
  65.         andl    $0xffff,%eax
  66.         ret
  67.  
  68.